package Java8Test;

import java.util.Arrays;
import java.util.stream.Stream;

public class StreamTest4 {
    public static void main(String[] args) {
        Stream<String> stream = Stream.of("Java 8", "Lambdas ", "In ","Action");
        stream.map(String::toUpperCase).forEach(System.out::println);

        int[] numbers = {2, 3, 5, 7, 11, 13};
        int sum = Arrays.stream(numbers).sum();
        System.out.println(sum);

        //无限流
        Stream.iterate(0, n -> n + 2)
              .limit(20)
              .forEach(System.out::println);

        //斐波那契数列

    }
}
